home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Network Support Library
/
RoseWare - Network Support Library.iso
/
apidev
/
u_chk.arc
/
USERIS.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1989-12-17
|
6KB
|
261 lines
Program USERIS;
{
John T. McCann, NOVUSER Wizard SysOp, 70007,3430
1/5/89
Written in Turbo Pascal v5.0
This program will, given a command line argument, verify a user's
login name on the current file server, ex:
USERIS JOHN
if JOHN is a valid LOGIN NAME (for a user) on the current file server
a DOS ERRORLEVEL of 0 is returned
if not valid, a DOS ERRORLEVEL of 1 is returned
if no command line arguement is entered 2 is returned
if not logged into any file servers (but the shell is loaded)
3 is returned
if the shell is not loaded 4 is returned
}
Uses Crt, Dos;
Const
inc = 'UserIs, (c)1989 Wizard Stuff';
Version = 1.0;
Type
HalfRegtype = record
Al,Ah,Bl,Bh,Cl,Ch,Dl,Dh:byte
end;
longs = record
ah,al,bh,bl:byte;
end;
MyWord = record
wh,wl : byte;
end;
e336cl = record
Native : MyWord;
Func : Byte; { $36 for get object name }
unique : Longs; { Unique ID for the object }
end;
e336rp = record
Native : MyWord;
id : longs; { same id as above }
ObjTyp : Myword; { type of object }
Name : array [1..48] of byte;
end;
chkcall = record
Native: MyWord;
Func : Byte; { $46 = get my bindery access level}
end;
chkrply = record
Native: MyWord;
Mask : Byte;
id : Longs;
end;
E33dcall = record
Native: MyWord;
Func : Byte; { 55 for Search for Users }
Last : Longs; { make it -1 }
ObjTyp: MyWord; { Search for users 0001 }
ObjNml: Byte; { 1 }
ObjNme: array[1..48] of Byte; { *, if search all is used }
end;
E33drply = record
Native : MyWord;
Id : Longs;
ObjectType: MyWord;
PropName : array [1..48] of Byte;
{ could add some space down here since I tell it the reply buffer
is 255 bytes long, but, that really isn't going to happen...}
end;
Var
Regs : Registers;
hr : HalfRegType absolute Regs;
cc : chkcall;
cr : chkrply;
nc : e336cl;
nr : e336rp;
pc : e33dcall;
pr : e33drply;
a : Integer;
Procedure UserI;
var
PS : String[80]; { just a string to hold the paramstr(1) variable }
Begin
/* NOTE I had used 1f on next line (last.ah), it is now ff, it is SUPPOSE to be ff, sorry
for any inconvenience this may cause, if you use 1f it will be a problem
with netware 386 */
with pc do
begin
last.ah:=$ff; { set the last object seen to -1 }
last.al:=$ff;
last.bh:=$ff;
last.bl:=$ff;
end;
pr.Native.wl:=$00;
pr.Native.wh:=$FF; { set up reply buffer size, note it really isn't 255
bytes long, but neither is the possible reply...}
pc.Native.wl:= $00;
pc.Native.wh:= $8+length(paramstr(1)); { set up length of request buffer }
pc.Func := $37; { scan bindery objects }
pc.ObjTyp.wh:= 0;
pc.ObjTyp.wl:= 1; { 01 = user object type }
pc.ObjNml := length(paramstr(1));
PS:=paramstr(1);
for a:=1 to (pc.ObjNml mod 48) do
begin
if ord(PS[a]) in [97..122] then PS[a]:=chr(ord(PS[a])-32); {convert to Upper Case}
pc.ObjNme[a]:=ord(PS[a]);
end;
Regs.Ax:=$E300;
Regs.Es:=Seg(Pr);
Regs.Di:=Ofs(Pr);
Regs.Ds:=Seg(Pc);
Regs.Si:=Ofs(Pc);
MsDos(Regs);
if hr.al=0 then halt(0) else halt(1);
End; { of Proc UserI }
Procedure Will_It_Run;
Begin
TextColor(7);
Regs.Ax:=$E300;
cc.Native.wl:=$00;
cc.Native.wh:=$01;
cr.Native.wl:=$00;
cr.Native.wh:=$ff;
cc.Func :=$46;
cr.Mask :=$00;
cr.id.al :=$00;
cr.id.ah :=$00;
cr.id.bl :=$00;
cr.id.bh :=$00;
Regs.Es:=Seg(cr);
Regs.Di:=Ofs(cr);
Regs.Ds:=Seg(cc);
Regs.Si:=Ofs(cc);
MsDos(Regs);
If (cr.id.al=$00) and
(cr.id.ah=$00) and
(cr.id.bl=$00) and
(cr.id.bh=$00)
then
Begin
TextColor(1);TextBackGround(3);ClrEol;
Writeln(inc);
ClrEol;
Writeln('This utility requires Advanced Netware to run.');
TextColor(7);TextBackGround(0);ClrEol;
Halt(4);
End;
Regs.Ax:=$E300;
nr.Native.wl:=$00;
nr.Native.wh:=$FF;
nc.Native.wl:=$00;
nc.Native.wh:=$05;
Regs.Es:=Seg(nr);
Regs.Di:=Ofs(nr);
Regs.Ds:=Seg(nc);
Regs.Si:=Ofs(nc);
nc.func:=$36;
nc.unique.ah:=cr.id.ah;
nc.unique.al:=cr.id.al;
nc.unique.bh:=cr.id.bh;
nc.unique.bl:=cr.id.bl;
MsDos(Regs);
if hr.al <> 0 then
Begin
TextColor(1);TextBackGround(3);ClrEol;
Writeln(inc);
ClrEol;
Writeln('This utility requires you to be logged into the network to run.');
TextColor(7);TextBackGround(0);ClrEol;
Halt(3);
End;
End; { of Will_it_Run }
Begin
If length(Paramstr(1)) <1 then
begin
TextColor(1);TextBackGround(3);ClrEol;
writeln(inc);
ClrEol;
writeln('Usage: USERIS xxxxx where xxxxx is the username to check');
writeln(' existence of on the current file server');
TextColor(7);TextBackGround(0);ClrEol;
halt(2);
end;
Will_It_Run;
UserI;
End.